package com.christianposta.learnddd.domain.model.handling;

import com.christianposta.learnddd.domain.shared.ValueObject;

/**
 * Types that describe the different types of Handling Events that can
 * occur and whether they require a voyage
 */
public enum HandlingType implements ValueObject<HandlingType> {
	
	LOAD(true),
	UNLOAD(true),
	RECEIVE(false),
	CLAIM(false),
	CUSTOMS(false);
	
	private final boolean voyageRequired;
	
	private HandlingType(final boolean voyageRequired){
		this.voyageRequired = voyageRequired;
	}
	
	public boolean requiresVoyage(){
		return this.voyageRequired;
	}
	
	public boolean prohibitsVoyage(){
		return !this.voyageRequired;
	}
	
	public boolean sameValueAs(HandlingType other) {
		return other != null && this.equals(other);
	}

}
